package com.cbhb.sys;

public class RestoreString {

    public static String restoreString(String s, int[] indices) {
        Character[] res = new Character[s.length()];
        for(int i = 0; i< s.length(); i++) {
            res[indices[i]] = s.charAt(i);
        }
        StringBuilder sb = new StringBuilder();
        for(Character ch: res) {
            sb.append(ch);
        }
        return sb.toString();
    }

    public static void main(String[] args) {
        System.out.println(restoreString("aiohn", new int[]{3, 1, 4, 2, 0}));
    }
}
